package design.mode.oberver.item2;

public class RegPromotionObserver implements RegObserver {
    private PromotionService promotionService;

    @Override
    public void handleRegSuccess(long userId) {
        //  1. 创建一个新的线程执行代码逻辑
        // promotionService.issueNewUserExperienceCash(userId);
        //  2. 函数中使用线程池来执行每个观察者的 handleRegSuccess() 函数
        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                promotionService.issueNewUserExperienceCash(userId);
            }
        });
        thread.start();
    }
}
